var t = getApp();

Component({
    properties: {
        params: {
            type: null
        },
        index: {
            type: null
        },
        data: {
            type: null
        },
        designer: {
            type: null
        },
        sessionurl: {
            type: null
        },
        Identification: {
            type: null
        },
        grouid: {
            type: null
        },
        total: {
            type: null
        },
        bottomShow: {
            type: null
        },
        isBottomnum: {
            type: null
        }
    },
    data: {
        language: "",
        showMore: !0,
        page: 1,
        total_page: 0,
        isLoadMore: !0
    },
    lifetimes: {
        attached: function() {
            var t = wx.getStorageSync("langIndex");
            this.setData({
                language: t.en
            }), this.triggerEvent("isLoadMorebtn", this.data.isLoadMore);
        },
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {},
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        gotoDetail: function(t) {
            var a = t.currentTarget.dataset.good.goodid;
            wx.navigateTo({
                url: "/packageA/detail_v2/detail_v2?id=" + a
            });
        },
        getMoreData: function() {
            var a = this;
            if (!(a.data.page >= a.data.total_page)) {
                a.setData({
                    page: a.data.page + 1
                });
                var e = t.getNetAddresss("home-page.get-page-goods");
                e += "&page=" + a.data.page, e += "&group_id=" + a.data.grouid, t._getNetWork({
                    url: e,
                    success: function(t) {
                        var e = t.data;
                        if (1 == e.result) {
                            var o = a.data.data;
                            a.setData({
                                data: o.concat(e.data.data)
                            }), a.data.page >= a.data.total_page && (a.setData({
                                isLoadMore: !1
                            }), a.triggerEvent("isLoadMorebtn", a.data.isLoadMore));
                        } else a.setData({
                            page: a.data.page - 1,
                            isLoadMore: !1
                        }), a.triggerEvent("isLoadMorebtn", a.data.isLoadMore);
                    },
                    fail: function(t) {
                        console.log(t);
                    }
                });
            }
        }
    },
    observers: {
        isBottomnum: function(t) {
            t > 1 && this.getMoreData();
        },
        params: function() {
            this.setData({
                showMore: !0,
                page: 1,
                total_page: 0,
                isLoadMore: !0
            }), this.triggerEvent("isLoadMorebtn", this.data.isLoadMore), this.setData({
                total_page: Math.ceil(this.data.total / 12)
            }), this.data.page >= this.data.total_page && (this.setData({
                isLoadMore: !1
            }), this.triggerEvent("isLoadMorebtn", this.data.isLoadMore));
        }
    }
});